//
//  MBProgressHUD+LS.m
//  Bel
//
//  Created by Leon on 16/1/29.
//  Copyright © 2016年 上海指旺信息科技有限公司. All rights reserved.
//

#import "MBProgressHUD+LS.h"

@implementation MBProgressHUD (LS)

- (void)showError:(NSString *)errorMessage {
    self.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"MBProgressHUD.bundle/error"]]];
    self.mode = MBProgressHUDModeCustomView;
    self.detailsLabelText = errorMessage;
    [self hide:YES afterDelay:1];
}

- (void)showSuccess:(NSString *)errorMessage {
    self.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"MBProgressHUD.bundle/success"]]];
    self.mode = MBProgressHUDModeCustomView;
    self.detailsLabelText = errorMessage;
    [self hide:YES afterDelay:1];
}

- (void)hide {
    [self hide:YES];
}


+ (void)showError:(NSString *)errorMessage {
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:[UIApplication sharedApplication].keyWindow animated:YES];
    [hud showError:errorMessage];
}

+ (void)showSuccess:(NSString *)successMessage {
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:[UIApplication sharedApplication].keyWindow  animated:YES];
    [hud showSuccess:successMessage];
}

+ (void)showMessage:(NSString *)message {
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:[UIApplication sharedApplication].keyWindow  animated:YES];
    hud.detailsLabelText = message;
}

+ (void)hide {
    [MBProgressHUD hideAllHUDsForView:[UIApplication sharedApplication].keyWindow animated:YES];
}

@end
